package com.swinboo.im.config;

import com.easemob.im.server.EMProperties;
import com.easemob.im.server.EMService;
import com.swinboo.im.properties.IMProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @author Swinboo
 * @date 2022-03-12 22:27
 * @description: IM配置类
 */
@Configuration
public class IMConfig {
    @Resource
    private IMProperties imProperties;
    @Bean
    public EMService service() {
        EMProperties properties = EMProperties.builder()
                .setAppkey(imProperties.getAppkey())
                .setClientId(imProperties.getClientId())
                .setClientSecret(imProperties.getClientSecret())
                .build();
        return new EMService(properties);
    }
}
